// Get current node
const int nodeId = nodeIdStack.top();
nodeIdStack.pop();
+ if (nodeId < 0 || nodeId >= static_cast<int>(model->Nodes.size()))
+ {
+ vtkErrorMacro("Invalid node index: " << nodeId << " , aborting.");
+ this->SetUpdateStatus(vtkImporter::UpdateStatusEnum::FAILURE);
+ return;
+ }
+
const auto& node = model->Nodes[nodeId];
// Add this node into the scene hierarchy
{
if (node.Mesh >= static_cast<int>(model->Meshes.size()))
{
- vtkErrorMacro("Invalid node mesh index, aborting.");
+ vtkErrorMacro("Invalid node mesh index: " << node.Mesh << " , aborting.");
this->SetUpdateStatus(vtkImporter::UpdateStatusEnum::FAILURE);
return;
}
// Get current node
int nodeId = nodeIdStack.top();
nodeIdStack.pop();
+
+ if (nodeId < 0 || nodeId >= static_cast<int>(model->Nodes.size()))
+ {
+ vtkErrorMacro("Invalid nodeId: " << nodeId << ", aborting.");
+ this->SetUpdateStatus(vtkImporter::UpdateStatusEnum::FAILURE);
+ return;
+ }
+
const vtkGLTFDocumentLoader::Node& node = model->Nodes[nodeId];
// Import node's camera